package com.hyh.user.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hyh.user.domain.Menu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

@Mapper
public interface MenuMapper extends BaseMapper<Menu> {

    @Select("SELECT DISTINCT menu.permission\n" +
            "FROM user_role \n" +
            "LEFT JOIN role on user_role.role_id=role.id\n" +
            "LEFT JOIN role_menu ON role_menu.role_id=user_role.role_id\n" +
            "LEFT JOIN menu ON role_menu.menu_id=menu.id\n" +
            "where user_id=#{userId} and role.`status`=0 and menu.`status`=0")
    public List<String> selectAuthentication(Long userId);
}
